xen: Fix VCPUOP_set_periodic_timer return value.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Sat, 10 Mar 2007 16:22:52 +0000 (16:22 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Sat, 10 Mar 2007 16:22:52 +0000 (16:22 +0000)
Clean up vcpu_op() code, and fix a couple of comments.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/domain.c
xen/common/schedule.c

index 00ca0d7aa659daf9e9bbbb3d0fe3c5e411504deb..7b4660fc913044ba6ea0741145c3fa602cc4b646 100644 (file)
@@ -546,16 +546,12 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
     {
     case VCPUOP_initialise:
         if ( (ctxt = xmalloc(struct vcpu_guest_context)) == NULL )
-        {
-            rc = -ENOMEM;
-            break;
-        }
+            return -ENOMEM;
 
         if ( copy_from_guest(ctxt, arg, 1) )
         {
             xfree(ctxt);
-            rc = -EFAULT;
-            break;
+            return -EFAULT;
         }
 
         LOCK_BIGLOCK(d);
@@ -569,9 +565,11 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
 
     case VCPUOP_up:
         if ( !test_bit(_VCPUF_initialised, &v->vcpu_flags) )
-            rc = -EINVAL;
-        else if ( test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) )
+            return -EINVAL;
+
+        if ( test_and_clear_bit(_VCPUF_down, &v->vcpu_flags) )
             vcpu_wake(v);
+
         break;
 
     case VCPUOP_down:
@@ -596,13 +594,11 @@ long do_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
     {
         struct vcpu_set_periodic_timer set;
 
-        rc = -EFAULT;
         if ( copy_from_guest(&set, arg, 1) )
-            break;
+            return -EFAULT;
 
-        rc = -EINVAL;
         if ( set.period_ns < MILLISECS(1) )
-            break;
+            return -EINVAL;
 
         v->periodic_period = set.period_ns;
         vcpu_force_reschedule(v);
index 447cc2744e3b438efb49e94fd1cc1fd13342bc03..f78319e3818bc345babb2f61c1535685f41d89f4 100644 (file)
@@ -110,7 +110,7 @@ int sched_init_vcpu(struct vcpu *v, unsigned int processor)
     else
         cpus_setall(v->cpu_affinity);
 
-    /* Initialise the per-domain timers. */
+    /* Initialise the per-vcpu timers. */
     init_timer(&v->periodic_timer, vcpu_periodic_timer_fn,
                v, v->processor);
     init_timer(&v->singleshot_timer, vcpu_singleshot_timer_fn,
@@ -471,7 +471,7 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE(void) arg)
 
 #ifndef COMPAT
 
-/* Per-domain one-shot-timer hypercall. */
+/* Per-vcpu oneshot-timer hypercall. */
 long do_set_timer_op(s_time_t timeout)
 {
     struct vcpu *v = current;